home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11972 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: sdrc.com!thor!scjones
  2. From: larry.jones@sdrc.com (Larry Jones)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: sprintf() question
  5. Date: 27 Mar 1996 21:44:17 GMT
  6. Organization: SDRC Engineering Services
  7. Distribution: world
  8. Message-ID: <4jccrh$3gb@info1.sdrc.com>
  9. References: <31593522.76B3@cbm.com>
  10. NNTP-Posting-Host: thor.sdrc.com
  11. Originator: scjones@thor
  12.  
  13. In article <31593522.76B3@cbm.com>, Dave Payne <paynedc@cbm.com> writes:
  14. > Is it safe, and more importantly, is it ANSI standard, to use sprintf()
  15. > to print into the same variable?  Consider this example:
  16.  
  17. NO! NO! A thousand times, NO!  (Can you tell I just spent a lot of time
  18. tracking down a problem in NCSA Mosaic which turned out to be exactly
  19. this?)  Except for functions that explicitly handle overlapping source
  20. and destination like memmove, if the source and destination overlap the
  21. behavior is undefined.
  22. ----
  23. Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
  24. larry.jones@sdrc.com
  25. I wonder if you can refuse to inherit the world. -- Calvin
  26.